﻿
using System;
using System.Collections.ObjectModel;
using fc2editor.DataModel.Descriptors;
namespace fc2editor.DataModel
{
    public class Aircraft
    {
        #region Properties

        public Guid ID
        {
            get
            {
                return descriptor.ID;
            }
        }

        public string Name
        {
            get
            {
                return descriptor.Name;
            }
        }

        public string FileName
        {
            get
            {
                return descriptor.FileName;
            }
        }

        public AircraftType Type
        {
            get
            {
                return descriptor.Type;
            }
        }

        public string Picture
        {
            get
            {
                return descriptor.Picture;
            }
        }

        public ReadOnlyCollection<Pylon> Pylons
        {
            get
            {
                return pylons;
            }
        }

        public ReadOnlyCollection<string> Tasks
        {
            get
            {
                return descriptor.Tasks.AsReadOnly();
            }
        }

        public string DefaultTask
        {
            get
            {
                return descriptor.DefaultTask;
            }
        }

        #endregion

        public Aircraft(AircraftDescriptor descriptor)
        {
            if (descriptor == null)
                throw new NullReferenceException("Illegal null-reference descriptor");

            this.descriptor = descriptor;
            pylons = new ReadOnlyCollection<Pylon>(descriptor.Pylons);
        }

        public override string ToString()
        {
            return Name;
        }

        private AircraftDescriptor descriptor;
        private ReadOnlyCollection<Pylon> pylons;
    }
}
